﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QLHS;

namespace QLSVPT1h
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }



        private void button2_Click(object sender, EventArgs e)
        {
            foreach (Control a in panel2.Controls)
            {
                if (a is TextBox)
                    a.Text = "";
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
                button1.Enabled = true;
            else
                button1.Enabled = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string gioiTinh;
            if (radioButton1.Checked == true)
                gioiTinh = "Nam";
            else
                gioiTinh = "Nữ";
            try
            {
                HocSinh p = new HocSinh();
                p.TiepNhanHocSinh(textBox1.Text, comboBox1.SelectedItem.ToString(), textBox7.Text, textBox2.Text + " " + textBox3.Text, textBox4.Text, gioiTinh, textBox5.Text, textBox6.Text, textBox7.Text);
                MessageBox.Show("Dữ liệu đã được insert thành công ");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message);
            }
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            Homepage_Form hp = new Homepage_Form();
            this.Visible = false;
            hp.Show();
        }

        private void label6_Click(object sender, EventArgs e)
        {
            TimKiemHS tk = new TimKiemHS();
            this.Visible = false;
            tk.Show();
        }

        private void label1_Click(object sender, EventArgs e)
        {
            Form1 f1 = new Form1();
            this.Visible = false;
            f1.Show();
        }

        private void label2_Click(object sender, EventArgs e)
        {
            ChinhSuaHS cs = new ChinhSuaHS();
            this.Visible = false;
            cs.Show();
        }

        private void label4_Click(object sender, EventArgs e)
        {
            ThayDoiQD csqd = new ThayDoiQD();
            this.Visible = false;
            csqd.Show();
        }

        private void label3_Click(object sender, EventArgs e)
        {
            Bang_diem_mon bd = new Bang_diem_mon();
            this.Visible = false;
            bd.Show();
        }

        private void label5_Click(object sender, EventArgs e)
        {
            BaoCao bc = new BaoCao();
            this.Visible = false;
            bc.Show();
        }

        private void label10_Click(object sender, EventArgs e)
        {
            Homepage_Form hp = new Homepage_Form();
            this.Visible = false;
            hp.Show();
        }

        

        

        
    }
}
